home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group96a.txt / 000082_icon-group-sender _Mon Apr 15 01:29:15 1996.msg < prev    next >
Internet Message Format  |  1996-09-05  |  761b

  1. Received: by cheltenham.cs.arizona.edu; Mon, 15 Apr 1996 07:00:34 MST
  2. Date: 15 Apr 96  09:27:09 BST
  3. From: R J Hare <rjhare@tattoo.ed.ac.uk>
  4. Subject: random numbers...
  5. To: icon-group@cs.arizona.edu
  6. Reply-To: rjhare@ed.ac.uk
  7. Organisation:  Edinburgh University Computing Services
  8. Message-Id:  <9604150927.ab22893@uk.ac.ed.tattoo>
  9. Errors-To: icon-group-errors@cs.arizona.edu
  10. Status: O
  11.  
  12. I'm writing a graphics program which requires that I perturb my x and
  13. y values randomly by -1|0|1 before plotting the object at the new x and y.
  14. There seem to be 2 obvious ways of doing this:
  15.  
  16. x := x-2+?3
  17. y := y-2+?3
  18.  
  19. or:
  20.  
  21. x := x+?[-1,0,1]
  22. y := y+?[-1,0,1]
  23.  
  24. Which is 'best' (quicker, easier to read, etc.)?
  25.  
  26. Opinions please...
  27.  
  28. Thanks
  29.  
  30. Roger Hare.
  31.